package com.hsy.swu.hsyutils

import android.content.Context
import android.os.Bundle
import androidx.viewbinding.ViewBinding
import com.google.android.material.bottomsheet.BottomSheetDialog

open class HsyBottomSheetDialog<VB : ViewBinding>(
    context: Context,
    private val onCreateCallback: (VB) -> Unit,
    private val onDetachedFromWindowCallback: () -> Unit = {}
) : BottomSheetDialog(context) {
    protected val mBinding = createViewBinding<VB>(layoutInflater)!!

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(mBinding.root)
        onCreateCallback(mBinding)
        mBinding.setFont()
    }

    override fun onDetachedFromWindow() {
        super.onDetachedFromWindow()
        onDetachedFromWindowCallback()
    }
}